package cn.tedu.spring.bean;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

/**
 * 在 UserService 中注入 UserDao对象
 * Service: 用于业务层,将该类标识为 Spring 组件
 */

@Service
public class UserService {
    @Value("注册业务")
    private String sname;
    //自动装配:根据类型UserDao
    @Autowired
    private UserDao userDao;

    @Override
    public String toString() {
        return "UserService{" +
                "sname='" + sname + '\'' +
                ", userDao=" + userDao +
                '}';
    }
}
